﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Microsoft.PowerShell.CmdletManagement"
    x:Class="Microsoft.PowerShell.CmdletManagement.ImportParameter"
    Title="Import parameters from this and other projects" Height="560" Width="825" 
    WindowStyle="ToolWindow" 
    WindowStartupLocation="CenterScreen" 
    ShowInTaskbar="False" >
    <Grid>
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition Width="Auto"/>
    		<ColumnDefinition Width="Auto"/>
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition Height="Auto" MinHeight="100"/>
    		<RowDefinition Height="Auto"/>
    	</Grid.RowDefinitions>

		<TextBlock Height="Auto" Margin="5,5,5,0" x:Name="Instructions" VerticalAlignment="Top" TextWrapping="Wrap" Grid.ColumnSpan="4"><Run Text="Parameters that you import become part of the current cmdlet, letting you change and modify their properties later."/></TextBlock>

		<TextBox Margin="5,15,5,10" x:Name="Search" TextChanged="Search_TextChanged"
				 GotFocus="Search_GotFocus" LostFocus="Search_LostFocus"
				 VerticalAlignment="Center" Foreground="#88000000" Text="Search" Grid.ColumnSpan="2" Grid.Row="1"/>
		
		<ListView HorizontalAlignment="Right" Margin="0,0,10,0" x:Name="SelectedItems" ItemsSource="{Binding}" Width="160" Grid.Column="3" Grid.Row="2" Grid.RowSpan="2">
			<ListView.View>
				<GridView>
					<GridViewColumn Header="Selected Parameters" Width="149" DisplayMemberBinding="{Binding Path=ParameterName}" />
				</GridView>
			</ListView.View>
		</ListView>

	

		<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,10,0" Width="75" Grid.Column="2" Grid.Row="2" Grid.RowSpan="2">
			<Button Height="23" x:Name="Add" Click="Click_Add" Width="75" Margin="0,0,0,10" Content="Add &gt;&gt;"/>
			<Button Height="23" x:Name="Remove" Click="Click_Remove" Width="75" Content="&lt;&lt; Remove"/>
        </StackPanel>
        
		
		<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Grid.Row="2" Grid.RowSpan="2" Margin="5,0,10,0">
    		<TextBlock Text="Show parameters" TextWrapping="Wrap" FontWeight="Bold" Margin="0,0,0,5"/>
    		<RadioButton IsChecked="True" Checked="ProjectButton_Checked" x:Name="ThisProject"  Content="Used in this project" Margin="0,0,0,5"/>
    		<RadioButton x:Name="AllProjects" Checked="ProjectButton_Checked" Content="Used in in all projects" Margin="0,0,0,5"/>
    	</StackPanel>

    	<ListView x:Name="ParameterList" Loaded="ParameterList_SizeChanged" SizeChanged="ParameterList_SizeChanged" ItemsSource="{Binding}" HorizontalAlignment="Left" MinHeight="100" MinWidth="100" VerticalAlignment="Stretch" Width="400" Height="300" Grid.Column="1" Grid.Row="2" Margin="0,0,0,5">
    		<ListView.View>
    			<GridView>
    				<GridViewColumn Header="Parameter Name" DisplayMemberBinding="{Binding Path=ParameterName}" />
    				<GridViewColumn Header="Type" DisplayMemberBinding="{Binding Path=Type}" />
					<GridViewColumn Header="Count" DisplayMemberBinding="{Binding Path=Count}" />
    			</GridView>
    		</ListView.View>
    	</ListView>
		
		<StackPanel Grid.Column="1" Grid.Row="3" Margin="0,0,0,0" Width="{Binding Path=ActualWidth, ElementName=ParameterList, Mode=OneWay}" HorizontalAlignment="Left">
			<TextBlock FontWeight="Bold" Margin="0,5,0,3"><Run Text="Description"/></TextBlock>
			<TextBlock TextWrapping="Wrap" Text="{Binding Path=SelectedItem.Description, ElementName=ParameterList}" />
		</StackPanel>

		<StackPanel x:Name="CommitButtons" Grid.Column="0" Grid.Row="4" Margin="0,10,0,0" Grid.ColumnSpan="4">
			<Rectangle Fill="{DynamicResource DialogBorderColor}" Height="1" Margin="0,5,0,3"/>

			<StackPanel Orientation="Horizontal"  HorizontalAlignment="Right" Margin="0,5,10,10" >
				<Button Height="23" Click="Click_Import"  Margin="0,0,10,0" x:Name="Import"  Width="75" Content="Import" />
				<Button Click="Click_Cancel" x:Name="Cancel"  Width="75" Content="Cancel" Height="23" Margin="0,0,0,0" />
			</StackPanel>
		</StackPanel>
		
    </Grid>
</Window>
